package com.angel.core.util;

import java.util.Map;

import com.alibaba.fastjson.JSON;

/**
 * Created by sariel on 2/20/14.
 */
public class JsonUtils {

    public static <T extends Object> T toObject(String jsonStr, Class clazz) {
        return (T) JSON.parseObject(jsonStr, clazz);
    }

    public static <V extends Object> Map<String, V> toMap(String jsonStr) {
        Map<String, V> map = JSON.parseObject(jsonStr, Map.class);
        return map;
    }

    public static String toJson(Object obj) {
        return JSON.toJSONString(obj);
    }
}